package com.epalmpay.service.datareport.impl;

import com.epalmpay.dto.trade.TradeInDTO;
import com.epalmpay.dto.trade.TradeOutDTO;
import com.epalmpay.exception.ApplicationException;
import com.epalmpay.mapper.TradeOfflineMapper;
import com.epalmpay.service.datareport.IShopDataReportService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/4/26.
 */
@Service("shopDataReportService")
public class ShopDataReportServiceImpl implements IShopDataReportService {

    @Resource
    private TradeOfflineMapper tradeOfflineMapper;

    @Override
    public List<Map<String, Object>> shopTradeData(Map map) throws ApplicationException {
        return tradeOfflineMapper.shopTradeData(map);
    }

    @Override
    public TradeOutDTO shopOutData(TradeInDTO tradeInDTO) throws ApplicationException {
        tradeInDTO.setSearchkey(tradeInDTO.getSearchkey()+"-01");
        return tradeOfflineMapper.shopOutData(tradeInDTO);
    }

    @Override
    public List<Map> shopDayTradeData(Map<String, Object> param) {
        if(param.get("flag").toString().equals("1")){
            param.put("searchkey",param.get("searchkey")+"-01");
        }
        return tradeOfflineMapper.shopDayTradeData(param);
    }

}
